package BNS.surveys;

import java.util.*;
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
import java.rmi.*;
import javax.swing.*;
import BNS.graphs.*;
import BNS.plumbing.*;

public class SurveyPersona extends BNSPersona implements ActionListener {
	private int myID, qNumber;
	private SurveyGameInterface game;
	private JComponent panel;
	private JLabel question;
	private JTextArea answer;
	private JButton submit;
	
	public SurveyPersona(SurveyGameInterface g, int id) { 
		game=g; myID=id; 
		}
	
	public JComponent startPanel() {
		panel= new JPanel(new FlowLayout());
		question= new JLabel("question:");
		panel.add(question);
		answer= new JTextArea(20,50);
		panel.add(answer);
		return panel;
		}
	
	public JComponent killPanel() { return panel; }
	
	public void actionPerformed(ActionEvent e) {
		Object src= e.getSource();
		System.err.println("actionPerformed "+ src);
		try { game.alter(myID,qNumber,answer.getText()); }
		catch(RemoteException ex) { System.err.println(ex); }
		}
	
	public void gameUpdate(java.io.Serializable dataBlob) {
		int[] state= (int[])dataBlob;
		}
		
	public String getTitle() { return "SurveyPersona 1 (client "+myID+")"; }
			
	} // EOC SurveyPersona
